#!/bin/bash

function syntaxCheck
{
    FILE="$1"
    echo "Syntax check: $FILE"
    riot --validate --sink "$FILE"
}

function proc
{
    TMP=TT
    FILE="$1"
    shift
    CLASS="$1"
    shift
    NS="$1"
    shift
    echo "Schemagen: $FILE"

    # -e syntax
    schemagen --rdfs -i "$FILE" -n "$CLASS" -a "$NS" -o "$CLASS".java  "$@" 
    # Add imports
    echo "package com.hp.hpl.jena.sparql.vocabulary ;" >> "$TMP"
    echo >>"$TMP"
    cat "$CLASS".java >> "$TMP"
    mv "$TMP" "$CLASS".java
}

## syntaxCheck test-manifest-x.ttl
## syntaxCheck test-manifest.ttl
## syntaxCheck test-manifest_11.ttl

## syntaxCheck test-query.ttl
## syntaxCheck test-dawg.ttl

##  syntaxCheck result-set.ttl
##  proc result-set.ttl Result~/Projects/ARQ/vocabularies/SetGraphVocab \
##      'http://www.w3.org/2001/sw/DataAccess/tests/result-set#'
 
## syntaxCheck test-manifest.ttl
## proc test-manifest.ttl TestManifest \
##     "http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#"

## syntaxCheck test-manifest-1_1.ttl
## proc test-manifest-1_1.ttl TestManifest_11 \
##     "http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#"

## syntaxCheck test-update.n3
## proc test-update.n3 TestManifestUpdate_11 \
##     "http://www.w3.org/2009/sparql/tests/test-update#"

## syntaxCheck test-manifest-x.ttl
## proc test-manifest-x.ttl TestManifestX \
##     "http://jena.hpl.hp.com/2005/05/test-manifest-extra#"


## proc test-query.ttl VocabTestQuery \
##     "http://www.w3.org/2001/sw/DataAccess/tests/test-query#"
## 
## proc test-dawg.ttl TestDAWGVocab \
##     "http://www.w3.org/2001/sw/DataAccess/tests/test-dawg#"

## syntaxCheck  list-pfunction.ttl
## proc list-pfunction.ttl ListPFunction "http://jena.hpl.hp.com/ARQ/list#"

##java jena.schemagen -i schema.rdf -o Earl.java -a http://www.w3.org/ns/earl# --inference

syntaxCheck  EARL.rdf
proc EARL.rdf VocabEARL "http://www.w3.org/ns/earl#"

## syntaxCheck  FOAF.ttl
## proc FOAF.ttl FOAF "http://xmlns.com/foaf/0.1/"

## syntaxCheck  doap.ttl
## proc doap.ttl DOAP "http://usefulinc.com/ns/doap#"
